import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import "@/styles/global.less";
import eventBus from "@/eventBus.js";
import "@/mock";
import Mock from "mockjs";
import showMessage from "@/utils/showMessage/showMessage.js";
import { loading, lazy } from "@/directives";

import store from "@/store";

store.dispatch("loginUser/whoAmI");

Vue.directive("loading", loading);
Vue.directive("lazy", lazy);

Mock.setup({
  timeout: "200-500",
});

Vue.prototype.$showMessage = showMessage;
Vue.prototype.$eventBus = eventBus;

window.vm = new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
